var configwx = {
            title:'',
            desc: times,
            imgUrl:'https://qqpublic.qpic.cn/qq_public/0/0-3099194066-A0B23DCA623A10493B8A6AE7067E60E9/0',
            link: flyurl,
            type:'link',
            dataUrl:'',
            success:function (e) {
                if(e.errMsg == 'sendAppMessage:ok' || e.errMsg == 'onMenuShareAppMessage:ok'){
                    ShareApp(obj);
                }else{
                    ShareTime(obj);
                }
            },
            cancel:function (e) {
            }
        };
var configwxt= {
            title:at,
            desc: times,
            imgUrl:'https://qqpublic.qpic.cn/qq_public/0/0-3099194066-A0B23DCA623A10493B8A6AE7067E60E9/0',
            link: flyurl,
            type:'link',
            dataUrl:'',
            success:function (e) {
                if(e.errMsg == 'sendAppMessage:ok' || e.errMsg == 'onMenuShareAppMessage:ok'){
                    ShareApp(obj);
                }else{
                    ShareTime(obj);
                }
            },
            cancel:function (e) {
            }
        };
        
        var url='http://6.tjbaodao.cn/api/zfwxshear?id=8&debug=121&type=jsonp&url='+encodeURIComponent(location.href.split('#')[0]);
        url="/wxwach.php?url="+encodeURIComponent(location.href.split('#')[0]);
        $.ajax({
              type:"get",    //请求方式
              async:true,    //是否异步
              url:url,
              //dataType:"jsonp",    //跨域json请求一定是jsonp
             // jsonp: "dataparam",    //跨域请求的参数名，默认是callback
              dataType:"json",
              processData:false,
              success: function(data) {      
                wx.config({
                    debug:false,
                    appId: data.appId, // 必填，公众号的唯一标识
                    timestamp:data.timestamp , // 必填，生成签名的时间戳
                    nonceStr: data.nonceStr, // 必填，生成签名的随机串
                    signature: data.signature,// 必填，签名
                    jsApiList: [
                        'onMenuShareTimeline',
                        'onMenuShareAppMessage',
                        'hideOptionMenu',
                        'showOptionMenu',
                        'hideMenuItems',
                        'showMenuItems',
                        'closeWindow'
                    ]
                });
                 wx.ready(function () {
                     wx.onMenuShareAppMessage(configwx);       
                     wx.onMenuShareTimeline(configwxt);
                     wx.error(function (data) {
                     });
                  });
            },
            error:function(XMLHttpRequest, textStatus, errorThrown) {}
        });
        function dataparam(data){
            console.log(data);
        }       
        var ShareApp = function (obj) {

        };

        var ShareTime = function (obj) {

        };
        /**
         * 1 隐藏群 显示群
         * 2 隐藏群 显示朋友圈
         * 3 隐藏朋友圈 显示朋友圈
         * 4 隐藏朋友圈 显示群
         */
        var HideApp = function (code) {
            switch (code){
                case 1:
                    wx.hideMenuItems({menuList:['menuItem:share:appMessage']});
                    wx.showMenuItems({menuList:['menuItem:share:appMessage']});
                    break;
                case 2:
                    wx.hideMenuItems({menuList:['menuItem:share:appMessage']});
                    wx.showMenuItems({menuList:['menuItem:share:timeline']});
                    break;
                case 3:
                    wx.hideMenuItems({menuList:['menuItem:share:timeline']});
                    wx.showMenuItems({menuList:['menuItem:share:timeline']});
                    break;
                default:
                    wx.hideMenuItems({menuList:['menuItem:share:timeline']});
                    wx.showMenuItems({menuList:['menuItem:share:appMessage']});
                    break;
            }
        };